/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package doc2db.stdstreams;

import java.awt.Color;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.Locale;
import javax.swing.JTextArea;

/**
 *
 * @author yura
 */
public class Err extends PrintStream {

    private int end = 0;
    private static JTextArea text;

    public void setTextArea(JTextArea t){
        text = t;
    }

    public Err(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException {
        super(file, csn);
    }

    public Err(File file) throws FileNotFoundException {
        super(file);
    }

    public Err(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException {
        super(fileName, csn);
    }

    public Err(String fileName) throws FileNotFoundException {
        super(fileName);
    }

    public Err(OutputStream out, boolean autoFlush, String encoding)
            throws UnsupportedEncodingException {
        super(out, autoFlush, encoding);
    }

    public Err(OutputStream out, boolean autoFlush) {
        super(out, autoFlush);
    }

    public Err(OutputStream out) {
        super(out);
    }

    @Override
    public PrintStream append(CharSequence csq) {
        return null;
    }

    @Override
    public PrintStream append(CharSequence csq, int start, int end) {
        return null;
    }

    @Override
    public PrintStream append(char c) {
        return null;
    }

    @Override
    public boolean checkError() {
        return false;
    }

    @Override
    protected void clearError() {
    }

    @Override
    public void close() {
    }

    @Override
    public void flush() {
    }

    @Override
    public PrintStream format(String format, Object... args) {
        return null;
    }

    @Override
    public PrintStream format(Locale l, String format, Object... args) {
        return null;
    }

    @Override
    public void print(boolean b) {
        this.print("" + b);
    }

    @Override
    public void print(char c) {
        this.print("" + c);
    }

    @Override
    public void print(int i) {
        this.print("" + i);
    }

    @Override
    public void print(long l) {
        this.print("" + l);
    }

    @Override
    public void print(float f) {
        this.print("" + f);
    }

    @Override
    public void print(double d) {
        this.print("" + d);
    }

    @Override
    public void print(char[] s) {
        this.print("" + new String(s).toString());
    }

    @Override
    public void print(String s) {
        text.insert(s, text.getText().length() - this.end);
    }

    @Override
    public void print(Object obj) {
        this.print(obj.toString());
    }

    @Override
    public PrintStream printf(String format, Object... args) {
        return null;
    }

    @Override
    public PrintStream printf(Locale l, String format, Object... args) {
        return null;
    }

    @Override
    public void println() {
        this.println("");
    }

    @Override
    public void println(boolean x) {
        this.println("" + x);
    }

    @Override
    public void println(char x) {
        this.println("" + x);
    }

    @Override
    public void println(int x) {
        this.println("" + x);
    }

    @Override
    public void println(long x) {
        this.println("" + x);
    }

    @Override
    public void println(float x) {
        this.println("" + x);
    }

    @Override
    public void println(double x) {
        this.println("" + x);
    }

    @Override
    public void println(char[] x) {
        this.println(new String(x));
    }

    @Override
    public void println(String x) {
        text.insert(x + "\n", text.getText().length() - this.end);
    }

    @Override
    public void println(Object x) {
        this.println(x.toString());
    }

    @Override
    protected void setError() {
        text.setForeground(Color.red);
    }

    @Override
    public void write(int b) {
    }

    @Override
    public void write(byte[] buf, int off, int len) {
    }
}